<include file="header"/>
<link rel="stylesheet" type="text/css" href="/assets/base/bonsai/css/swiper.min.css">

<body>
<div class="wraper">
	<div class="head clearfix">
		<a href="javascript:history.go(-1);" class="iconfont icon-fanhui72 pull-left"></a>
		<span class="head-name pull-left">{BEESCRM:$webtitle}</span>
		<input name="OrderId" id="OrderId" type="hidden"/>
	</div>
<if condition="$type eq 1">
	<volist name="data" id="vo">
	
	<div class="margin-t" id="margin-t{BEESCRM:$vo.order_id}">
		<div class="gray-block">
			<p><if condition="($vo['solution'] eq 0) AND ($vo['status'] eq 1)">待商家确认
			<elseif condition="($vo['solution'] eq 1) AND ($vo['status'] eq 1)" />等待商家提供方案
			<elseif condition="($vo['solution'] eq 1) AND ($vo['status'] eq 2)" />服务商已提供方案，请确认…
			<elseif condition="($vo['solution'] eq 1) AND ($vo['status'] eq 6)" />服务商已修改方案，请确认…
			</if></p>
			<p class="font-small">订单编号：{BEESCRM:$vo.order_sn}<span class="pull-right">{BEESCRM:$vo.create_time|date="Y-m-d H:i",###}</span></p>
			<p class="font-small">摆放地点：{BEESCRM:$vo.college}{BEESCRM:$vo.department}{BEESCRM:$vo.address}</p>
			<if condition="$vo['type'] neq 2">
				<p class="font-small">摆放时长：{BEESCRM:$vo.use_long}天</p>
				<p class="font-small">订单类型：长期</p>
			<else/>
				<p class="font-small">订单类型：会场</p>
			</if>
			<p class="font-small">摆放日期：{BEESCRM:$vo.use_start_time|date="Y-m-d",###} 至 {BEESCRM:$vo.use_end_time|date="Y-m-d",###}
		</div>
		
		<if condition="($vo['solution'] eq 1) AND ($vo['status'] eq 1)">
			<a href="{BEESCRM::U('base/bonsai/orderDetail', array('wechat_id'=>$wechat_id, 'order_id'=>$vo['order_id'],'origin'=>$origin))}" class="white-block order-info text-center">
				服务商正在讨论方案，请耐心等待
			</a>
		<elseif condition="(($vo['solution'] eq 1) AND ($vo['status'] eq 2)) OR (($vo['solution'] eq 1) AND ($vo['status'] eq 6)) OR (($vo['solution'] eq 0) AND ($vo['status'] eq 1))" />
			<volist name="vo.order_goods" id="item" offset="0" length='1'>
				<a href="{BEESCRM::U('base/bonsai/orderDetail', array('wechat_id'=>$wechat_id, 'order_id'=>$vo['order_id'],'origin'=>$origin))}" class="white-block order-info">
					<div class="tb-mode">
						<div class="tb-cell info-left">
							<div class="image-box">
								<img src="{BEESCRM:$item.goods_image}"/>
							</div>
						</div>
						<div class="tb-cell line-h">
							<p class="text-green">{BEESCRM:$item.goods_name}</p>
							<p class="sub-contain"><if condition="$item['type'] eq 2">会场布置: {BEESCRM:$item.goods_price} 元/盆/场<else />长期摆放: {BEESCRM:$item.goods_price} 元/盆/天</if></p>
							<p class="sub-contain">预约数量：{BEESCRM:$item.goods_num} 盆</p>
							<p class="sub-contain">小计：<span class="text-red">￥{BEESCRM:$item.count}元</span></p>
						</div>
						<div class="tb-cell text-right">
							<span class="iconfont icon-you"></span>
						</div>
					</div>
					<p class="font-small">共{BEESCRM:$vo.order_goods_count}件商品
					<!-- <span class="pull-right">共{BEESCRM:$vo.order_goods_count}件商品</span> -->
					</p>
				</a>
				<div class="order-option tb-mode">
					<p class="tb-cell">预计总费用 <span class="text-red">￥{BEESCRM:$vo.goods_amount}元</span></p>
					<div class="pull-right">
					<if condition="(($vo['solution'] eq 1) AND ($vo['status'] eq 2)) OR (($vo['solution'] eq 1) AND ($vo['status'] eq 6))" >
						<a href="javascript:;" class="small-btn btn-red btn-agree" data-order_id="{BEESCRM:$vo.order_id}">同意</a>
					</if>
						<a href="javascript:;" data-order_id="{BEESCRM:$vo.order_id}" data-type=1 class="small-btn btn-blue">取消</a>
					</div>
				</div>
			</volist>
		
		</if>
	</div>
	
	</volist>
<elseif condition="($type eq 2) OR ($type eq 3)" /><!-- 待验收，评价 -->
	<volist name="data" id="vo">
	<div id="margin-t{BEESCRM:$vo.order_id}" class="margin-t">
		<div class="gray-block">
			<p>待验收</p>
			<p class="font-small">订单编号：{BEESCRM:$vo.order_sn}<span class="pull-right">{BEESCRM:$vo.create_time|date="Y-m-d H:i",###}</span></p>
			<p class="font-small">摆放地点：{BEESCRM:$vo.college}{BEESCRM:$vo.department}{BEESCRM:$vo.address}</p>
			<if condition="$vo['type'] neq 2">
				<p class="font-small">摆放时长：{BEESCRM:$vo.use_long}天</p>
				<p class="font-small">订单类型：长期</p>
			<else/>
				<p class="font-small">订单类型：会场</p>
			</if>
			<p class="font-small">摆放日期：{BEESCRM:$vo.use_start_time|date="Y-m-d",###} 至 {BEESCRM:$vo.use_end_time|date="Y-m-d",###}
		</div>
		<volist name="vo.order_goods" id="item" offset="0" length='1'>
		<a href="{BEESCRM::U('base/bonsai/orderDetail', array('wechat_id'=>$wechat_id, 'order_id'=>$vo['order_id'],'origin'=>$origin))}" class="white-block order-info">
			<div class="tb-mode">
				<div class="tb-cell info-left">
					<div class="image-box">
						<img src="{BEESCRM:$item.goods_image}"/>
					</div>
				</div>
				<div class="tb-cell line-h">
					<p class="text-green">{BEESCRM:$item.goods_name}</p>
					<p class="sub-contain"><if condition="$item['type'] eq 2">会场布置: {BEESCRM:$item.goods_price} 元/盆/场<else />长期摆放: {BEESCRM:$item.goods_price} 元/盆/天</if></p>
					<p class="sub-contain">预约数量：{BEESCRM:$item.goods_num} 盆</p>
					<p class="sub-contain">小计：<span class="text-red">￥{BEESCRM:$item.count}元</span></p>
				</div>
				<div class="tb-cell text-right">
					<span class="iconfont icon-you"></span>
				</div>
			</div>
			<p class="font-small">共{BEESCRM:$vo.order_goods_count}件商品</p>
		</a>
		<div class="order-option tb-mode">
			<p class="tb-cell">预计总费用 <span class="text-red">￥{BEESCRM:$vo.goods_amount}元</span></p>
			<div class="pull-right">
				<if condition="$type eq 2"><a href="javascript:;" data-order_id="{BEESCRM:$vo.order_id}" class="small-btn btn-green">验收</a></if>
				<if condition="$type eq 3"><a href="javascript:;" data-order_id="{BEESCRM:$vo.order_id}" class="small-btn btn-red" id="comment">评价</a></if>
			</div>
		</div>
		</volist>
	</div>
	</volist>
	
<elseif condition="$type eq 4" />
	<volist name="data" id="vo">
	<div class="margin-t">
		<div class="gray-block">
			<p class="font-small">订单编号：{BEESCRM:$vo.order_sn}</p>
			<p class="font-small">成交时间：{BEESCRM:$vo.finish_time|date="Y-m-d H:i",###}</p>
			<p class="font-small">摆放地点：{BEESCRM:$vo.college}{BEESCRM:$vo.department}{BEESCRM:$vo.address}</p>
			<if condition="$vo['type'] neq 2">
				<p class="font-small">摆放时长：{BEESCRM:$vo.use_long}天</p>
				<p class="font-small">订单类型：长期</p>
			<else/>
				<p class="font-small">订单类型：会场</p>
			</if>
			<p class="font-small">摆放日期：{BEESCRM:$vo.use_start_time|date="Y-m-d",###} 至 {BEESCRM:$vo.use_end_time|date="Y-m-d",###}
		</div>
		
		<if condition="$vo['order_goods']">
			<volist name="vo.order_goods" id="item" offset="0" length='1'>
				<a href="{BEESCRM::U('base/bonsai/orderDetail', array('wechat_id'=>$wechat_id, 'order_id'=>$vo['order_id'],'origin'=>$origin))}" class="white-block order-info">
					<div class="tb-mode">
						
						<div class="tb-cell info-left">
							<div class="image-box">
								<img src="{BEESCRM:$item.goods_image}"/>
							</div>
						</div>
						<div class="tb-cell line-h">
							<p class="text-green">{BEESCRM:$item.goods_name}</p>
							<p class="sub-contain"><if condition="$item['type'] eq 2">会场布置: {BEESCRM:$item.goods_price} 元/盆/场<else/>长期摆放: {BEESCRM:$item.goods_price} 元/盆/天</if></p>
							<p class="sub-contain">预约数量：{BEESCRM:$item.goods_num} 盆</p>
							<p class="sub-contain">小计：<span class="text-red">￥{BEESCRM:$item.count}元</span></p>
						</div>
						<div class="tb-cell text-right">
							<span class="iconfont icon-you"></span>
						</div>
					</div>
					<p class="font-small">共{BEESCRM:$vo.order_goods_count}件商品</p>
				</a>
				<div class="order-option tb-mode">
					<p class="tb-cell">预计总费用 <span class="text-red">￥{BEESCRM:$vo.goods_amount}元</span></p>
					<div class="pull-right">
						<span class="pull-right text-gray"><if condition="$vo['status'] eq 3">已取消<else />已完成</if></span>
					</div>
				</div>
			</volist>
		<else/>
				<div class="order-option tb-mode">
					<div class="pull-right">
						<span class="pull-right text-gray"><if condition="$vo['status'] eq 3">已取消</if></span>
					</div>
				</div>
		</if>
	</div>
	</volist>
</if>

<include file="nav"/>
	
</div>
<if condition="$type eq 3">
<div class="pop-box comment-box">
	<div class="main">
		<p class="pop-list text-center">评价<span class="iconfont icon-guanbi close pull-right"></span></p>
		<div class="pop-list clearfix">
			<p class="check-list checked" data-content="1"><span class="iconfont icon-xuanzedianjihou"></span>非常满意</p>
			<p class="check-list" data-content="2"><span class="iconfont icon-xuanzedianjihou"></span>满意</p>
			<p class="check-list" data-content="3"><span class="iconfont icon-xuanzedianjihou"></span>不满意</p>
		</div>
		<div class="block-space">
			<textarea maxlength="20" placeholder="请详细描述，不超过20个中文汉字" id="content"></textarea>
		</div>
		<div class="pop-btn">
			<input type="hidden" id="order_id">
			<input type="hidden" id="comment_star" value="1">
			<a href="javascript:void(0);" id="up">确认提交</a>
		</div>
	</div>
</div>
</if>

<include file="commonJs"/>
<script src="/assets/base/bonsai/js/swiper.min.js"></script>

<script>
	var nav_h = $('.nav').height();
	$('.wraper').css('paddingBottom',nav_h+8);


	<if condition="$type eq 3">
	$('.btn-red').click(function(){
		$('.comment-box').show();
	});
	$('.close').click(function(){
		$('.comment-box').hide();
	});
	$('.btn-red').click(function(){
		$('#order_id').val($(this).data('order_id'));
	});
	
	$('.check-list').click(function(){
		$(this).addClass('checked');
		$(this).siblings().removeClass('checked');
		var value = $(this).data('content');
		$("#comment_star").val(value);
	});
	
	$('#up').click(function(){
		var order_id = $('#order_id').val();
		var comment_star = $("#comment_star").val();
		var comment = $("#content").val();
		var data = {}, json = {};
		data.order_id = order_id;
		data.comment_star = comment_star;
		data.comment = comment;
		data.status = 5;
		json.method = 'post';
		json.type = 'json';
		json.url = "{BEESCRM::U('/base/bonsai/changeStatus', array('wechat_id'=>$wechat_id))}";
		json.data = data;
		$.getAjax(json, true, todetail, '');
		$("#content").val('');
	});
	</if>
	
	<if condition="$type eq 1">	
		$('.btn-blue').click(function(){
			var order_id = $(this).data('order_id');
			$('#OrderId').val(order_id);
			$.confirm('确认取消此预约订单？', yesDo);
		});
		
		function yesDo(){
			//var order_id = $(this).data('order_id');
			var order_id = $('#OrderId').val();
			var data = {}, json = {};
			data.order_id = order_id;
			data.status = 3;
			json.method = 'post';
			json.type = 'json';
			json.url = "{BEESCRM::U('/base/bonsai/changeStatus', array('wechat_id'=>$wechat_id))}";
			json.data = data;
			$.getAjax(json, true, delOrder, '');
		}
	</if>

	<if condition="$type eq 2">
		//验收此订单	
		$('.btn-green').click(function(){
			var order_id = $(this).data('order_id');
			$('#OrderId').val(order_id);
			$.confirm('确认验收此订单？', sayYes);
		});	
		
		function sayYes(){
		//$('.btn-green').click(function(){
			var order_id = $('#OrderId').val();;
			var data = {}, json = {};
			data.order_id = order_id;
			data.status = 4;
			json.method = 'post';
			json.type = 'json';
			json.url = "{BEESCRM::U('/base/bonsai/changeStatus', array('wechat_id'=>$wechat_id))}";
			json.data = data;
			$.getAjax(json, true, todetail, '');
		};
	</if>

	//同意服务上提供方案
	$('.btn-agree').click(function(){
		var order_id = $(this).data('order_id');
		$('#OrderId').val(order_id);
		$.confirm('确认同意此预约订单？', agreeDo);
	});
	
	function agreeDo(){
		var order_id = $('#OrderId').val();
		var data = {}, json = {};
		data.order_id = order_id;
		data.status = 7;
		json.method = 'post';
		json.type = 'json';
		json.url = "{BEESCRM::U('/base/bonsai/changeStatus', array('wechat_id' => $wechat_id))}";
		json.data = data;
		$.getAjax(json, true, delOrder, '');
	}
	
	//删除掉已取消的订单展示
	function delOrder(data){
		$('#margin-t'+data.data.order_id).remove();
		$('.comment-box').hide();
	}
	
	//评价完毕 去详情页面
	function todetail(data){
		var order_id = data.data.order_id;
		$('.comment-box').hide();
		setTimeout('location.href="{BEESCRM::U('/base/bonsai/orderdetail', array('wechat_id'=>$wechat_id, 'origin'=>$origin))}/order_id/'+order_id+'"', 1000);
	}
	
</script>
</body>
</html>
